package com.lcz.googleplay.activity;

import android.app.Application;
import android.content.Context;
import android.os.Handler;

import com.yolanda.nohttp.NoHttp;
import com.yolanda.nohttp.cache.DiskCacheStore;

/**
 * 代表当前应用程序
 * 获取context对象
 *
 * @author
 */
public class BaseApplication extends Application {
    private static BaseApplication application;
    private static int mainTid;
    private static Handler handler;

    @Override
    public void onCreate() {
        super.onCreate();
        // NoHttp初始化,设置缓存到本地SD卡
        NoHttp.initialize(this,
                new NoHttp.Config().setCacheStore(new DiskCacheStore(this)));
        application = this;
        mainTid = android.os.Process.myTid();
        handler = new Handler();

    }

    public static Context getApplication() {
        return application;
    }

    public static int getMainTid() {
        return mainTid;
    }

    public static Handler getHandler() {
        return handler;
    }
}
